//路由表配置：src/routes/index.jsx
import { Navigate } from 'react-router-dom';
//路由懒加载
import { lazy, Suspense } from 'react'


const Home = lazy(() => import('../views/Home/Home'));

// 封装懒加载
const withLoading = (comp) => (
	<Suspense fallback={<h2>加载中....</h2>}>
		{comp}
	</Suspense >
)

const routes = [
	// Navigate 重定向
	{ path: '/', element: <Navigate to='/home' /> },
	{
		path: '/home', element: withLoading(<Home />)
	},

];

export default routes;